/*
 * ActionMenuItem.java
 *
 * Created on March 27, 2005, 12:58 AM
 */

package tools;

import javax.swing.Action;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

/**
 *
 * @author Keith
 */
public class ActionMenuItem extends JMenuItem {
  
  public ActionMenuItem( String menuItemName, String s ){
    super( s );
    setName( menuItemName );
  }

  public ActionMenuItem( String menuItemName, Action a ){
    super( a );
    setName( menuItemName );
  }

  public void setAction( Action a ) {
    super.setAction( a );

    KeyStroke ak = (KeyStroke)a.getValue( a.ACCELERATOR_KEY );
    if ( ak != null ){
      setAccelerator( ak );
    }
  }
}
